﻿using System.Web.Mvc;
using System.Web.Routing;

namespace RHD.Web.Infrastructure.AuthorizeAttributes {
	public class Authentication : BaseAuthorizeAttribute {
		protected override bool AuthorizePrincipal(Principal principal) {
			return principal.IsAuth;
		}

		protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) {
			filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary { { "action", "LogOn" }, { "controller", "Account" } });
		}
	}
}